package com.stms.dao;

import com.stms.pojo.Invoice;
import com.stms.pojo.Purchase;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface InvoiceRepository extends JpaRepository<Invoice,Integer> {
    @Modifying
    @Transactional
    @Query(value = "delete from invoice where id in(?1)",nativeQuery = true)
    public void deleteBatch(List<Integer> id);

    Page<Invoice> findAll(Specification<Invoice> purchaseSpecification, Pageable pageable);
}
